package com.xinyue.user.dao;

import com.xinyue.user.pojo.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(User record);

    User selectByPrimaryKey(Integer id);

    List<User> selectAll();

    int updateByPrimaryKey(User record);

   @Select("select * from xy_user where username = #{username} and password = #{password}")
    User selectToLoginByUsername(@Param("username") String username, @Param("password")String password);

    @Select("select * from xy_user where phone = #{phone} and password = #{password}")
    User selectToLoginByPhone(@Param("phone") String phone,@Param("password") String password);

    @Select("select * from xy_user where phone = #{phone} ")
        //判断手机号是否为第一次登录
    User selectByPhone(@Param("phone") String phone);
}